home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / dd / source.c.deleted < prev    next >
C/C++ Source or Header  |  1992-07-17  |  2KB  |  66 lines

  1. #include    "defs.h"
  2. #include    "dbug_protos.h"
  3.  
  4. // ************************************************************************
  5.  
  6. Prototype WORD        RefreshSource(WORD maxLines, BOOL fullRefresh);
  7.  
  8. // ************************************************************************
  9.  
  10.  
  11.     DEBUG    *debug = FindDebug(windowTop);
  12.     SOURCE    *source;
  13.  
  14.     if (!debug) return FALSE;
  15.     source = FindSource(debug, windowTop);
  16.     while (source != debug->tableEnd) {
  17.         if (source->address != windowTop) {
  18.             windowTop = source->address;
  19.             RefreshWindow(TRUE);
  20.             return TRUE;
  21.         }
  22.         ++source;
  23.     }
  24.     return FALSE;
  25. }
  26.  
  27. WORD    RefreshSource(WORD maxLines, BOOL fullRefresh) {
  28.     ULONG    address = windowTop;
  29.     WORD    count = 0;
  30.     char    *line, *lineEnd;
  31.     SOURCE    *source, *nextSource;
  32.     DEBUG    *debug;
  33.     ULONG    lineNum;
  34.  
  35.     if (maxLines) {
  36.         ScrPuts("\x9b0m\x9b7mSOURCE MODE");
  37.         count++; Newline(); maxLines--;
  38.     }
  39.  
  40.     debug = FindDebug(address);
  41.     if (!debug || !debug->source) return count;
  42.     source = FindSource(debug, address);
  43.     while (maxLines > 0 && source != debug->tableEnd) {
  44.         address = source->address;
  45.         nextSource = &source[1];
  46.         if (address == programPC) ScrHighlight();
  47.         if (IsBreakpoint(address)) ScrItalics();
  48.         line = FindSourceLine(debug, source);
  49.         windowBottom = address;
  50.         lineNum = source->lineNumber;
  51.         while (maxLines > 0) {
  52.             lineEnd = line;
  53.             while (*lineEnd && *lineEnd != '\n') lineEnd++;
  54.             ScrPrintf("%6d. ", lineNum); // PrintAddress(address);
  55.             ScrWrite(line, lineEnd-line);
  56.             line = lineEnd;
  57.             if (*line) line++; else return count;
  58.             Newline(); count++; maxLines--;
  59.             lineNum++; if (nextSource != debug->tableEnd && lineNum >= nextSource->lineNumber) break;
  60.         }
  61.         source = nextSource;
  62.     }
  63.     return count;
  64. }
  65.  
  66.